
#ifndef __LOG_LEVEL_HPP__
#define __LOG_LEVEL_HPP__

#include    <string>

namespace   tiny
{

class   LogLevel
{

public  :
    typedef enum { 
        NONE = 10000,
        FATAL = 9000,
        ERROR = 8000,
        WARN = 7000,
        INFO = 6000,
        DEBUG = 5000,
        TRACE = 4000,
        ANY = 1000,
    } level_type;

public :
    static  const std::string   LEVEL_NAME_FATAL;
    static  const std::string   LEVEL_NAME_ERROR;
    static  const std::string   LEVEL_NAME_WARN;
    static  const std::string   LEVEL_NAME_INFO;
    static  const std::string   LEVEL_NAME_DEBUG;
    static  const std::string   LEVEL_NAME_TRACE;
    static  const std::string   LEVEL_NAME_UNKNOWN;

//    const std::string   LEVEL_NAME_FATAL = "FATAL";
//    const std::string   LEVEL_NAME_ERROR = "ERROR";
//    const std::string   LEVEL_NAME_WARN = "WARN";
//    const std::string   LEVEL_NAME_INFO = "INFO";
//    const std::string   LEVEL_NAME_DEBUG = "DEBUG";
//    const std::string   LEVEL_NAME_TRACE = "TRACE";
//    const std::string   LEVEL_NAME_UNKNOWN = "UNKNWON";

public  :
    static  int     getFatalLevel() { return FATAL; }
    static  int     getErrorLevel() { return ERROR; }
    static  int     getWarnLevel() { return WARN; }
    static  int     getInfoLevel() { return INFO; }
    static  int     getDebugLevel() { return DEBUG; }
    static  int     getTraceLevel() { return TRACE; }

    static  const std::string&  getLevelName(int iLevel) 
    {
        switch ( iLevel ) {
        case    FATAL   :
            return  LEVEL_NAME_FATAL;
            break;
        case    ERROR   :
            return  LEVEL_NAME_ERROR;
            break;
        case    WARN   :
            return  LEVEL_NAME_WARN;
            break;
        case    INFO   :
            return  LEVEL_NAME_INFO;
            break;
        case    DEBUG   :
            return  LEVEL_NAME_DEBUG;
            break;
        case    TRACE   :
            return  LEVEL_NAME_TRACE;
            break;
        } 
        
        return  LEVEL_NAME_UNKNOWN;
    }

    static  const std::string&  getFatalLevelName() { return LEVEL_NAME_FATAL; }
    static  const std::string&  getErrorLevelName() { return LEVEL_NAME_ERROR; }
    static  const std::string&  getWarnLevelName() { return LEVEL_NAME_WARN; }
    static  const std::string&  getInfoLevelName() { return LEVEL_NAME_INFO; }
    static  const std::string&  getDebugLevelName() { return LEVEL_NAME_DEBUG; }
    static  const std::string&  getTraceLevelName() { return LEVEL_NAME_TRACE; }

};  // class LogLevel

}   // namespace tiny

#endif  // __LOG_LEVEL_HPP__

